package com.mingtang.online.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

import com.mingtang.online.HideFragmentActivity;
import com.mingtang.online.R;
import com.mingtang.online.util.SharePreferenceUtil;


/**
 * Created by Administrator on 2016/11/15.
 */
public class SplashActivity extends BaseActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // 如果不是第一次启动app，则正常显示启动屏
        setContentView(R.layout.activity_welcome);

        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {

                boolean isFirstOpen = SharePreferenceUtil.getBoolean(SplashActivity.this, SharePreferenceUtil.FIRST_OPEN, true);
                // 如果是第一次启动，则先进入功能引导页
                if (isFirstOpen) {
                    Intent intent = new Intent(SplashActivity.this, WelcomeGuideActivity.class);
                    startActivity(intent);
                    finish();
                    return;
                } else {
                    startActivity(new Intent(SplashActivity.this, HideFragmentActivity.class));
                    finish();
                }
            }
        }, 3000);

    }

}
